
window.onload=function (){
    provinceChange();
};


function provinceChange() {
    let prostr="<option>请选择省/市</option>";
    let provinceText = document.getElementById("province");
    data.forEach(function(datas) {
        if(datas.parentid=="0"){
            //省则输出到省文本框
            prostr += "<option value='"+datas.codeid+"'>"+datas.cityName+"</option>";
            provinceText.innerHTML= prostr;
        }
    })
}

function cityChange(a) {
    let citystr=" <option>请选择城市/地区</option>";
    let cityText = document.getElementById("city");
    data.forEach(function(city) {
        if(city.parentid==a){
            //省则输出到省文本框
            citystr += "<option value='"+city.codeid+"'>"+city.cityName+"</option>";
            cityText.innerHTML= citystr;
        }
    })
}
